package com.hspedu.qqserver.service;

import java.util.HashMap;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/3/17
 * @time 21:05
 */
public class ManageServerConnectClientThread {

    private static volatile HashMap<String,ServerConnectClientThread> hashMap = new HashMap<>();

    protected static void addServerConnectClientThread(String userId, ServerConnectClientThread thread){
        hashMap.put(userId,thread);
    }

    protected static ServerConnectClientThread getServerConnectClientThread(String userId){
        return hashMap.get(userId);
    }

    protected static void deleteServerConnectClientThread(String userId){
        if (userId != null) {
            hashMap.remove(userId);
        }
    }

    protected static HashMap<String,ServerConnectClientThread> getAllServerThreads(){
        return hashMap;
    }
}
